<?php

require_once 'Zend/View/Helper/Abstract.php';

class Core_View_Helper_Cms_Block extends Zend_View_Helper_Abstract
{
    public function block($request, $params = null)
    {
        //process the block request
        $requestArray = explode('_', $request);
        $module = $requestArray[0];
        $controller = $requestArray[1];
        $action = $requestArray[2];

        // set the block module path. note that this resolves differently than the standard modules
        $module = $module . '_blocks';

        //check to see if the module block has already been added
        $front = Zend_Controller_Front::getInstance();
        $modulePaths = $front->getControllerDirectory();
        if (!isset($modulePaths[$moduleBlock])) {
            $front->addControllerDirectory();
        }
    }
}